package com.mk.cloud.common.interceptor.header;

import act.Act;
import act.controller.Controller;
import com.mk.cloud.common.config.AppConfig;
import com.mk.cloud.common.domain.PUser;


@SuppressWarnings("unused")
public class HeaderService extends Controller.Base {
    private static final String KEY_USER_KEY = "X-Partner-Token";

    @HeaderLoginUser
    protected PUser me;

    protected String getToken(){
        return context.req().header(KEY_USER_KEY);
    }

    protected void refreshCache(PUser user){
        Act.cache().put(getToken(),user, AppConfig.cache.ttl.get());
    }
}
